package com.lagou.app;

import com.lagou.dao.ProductDao;
import com.lagou.entity.Product;
import org.junit.Test;

import java.sql.SQLException;
import java.util.List;

public class TestProductDao {
    ProductDao productDao = new ProductDao();

    @Test
    public void testFindProductById() throws SQLException {
        Product product = productDao.findProducById("1");
        System.out.println(product.toString());
        System.out.println(product.getCategory().getCname());
    }

    @Test
    public void testGetCount() throws SQLException {
        int count = productDao.getCount("3");
        System.out.println(count);
    }

    @Test
    public void testFindProductByID() throws SQLException {
        List<Product> list = productDao.findProductByCid("2");
        for (Product product : list) {
            System.out.println(product.toString());
        }
    }
}
